---
id: 64496df724dd3716a71fe971
title: Step 26
challengeType: 0
dashedName: step-26
---

# --description--

Object properties consist of key/value pairs. You can use shorthand property names when declaring an object literal. When using the shorthand property name syntax, the name of the variable becomes the property key and its value the property value.

The following example declares a `user` object with the properties `userId`, `firstName`, and `loggedIn`.

```js
const userId = 1;
const firstName = "John";
const loggedIn = true;

const user = {
  userId,
  firstName,
  loggedIn,
};

console.log(user); // { userId: 1, firstName: 'John', loggedIn: true }
```

Para manter o controle de todas as funções da planilha, declare um objeto `spreadsheetFunctions`. Using the shorthand notation syntax, set `sum`, `average`, and `median` as properties on the `spreadsheetFunctions` object.

# --hints--

Você deve declarar uma variável `spreadsheetFunctions`.

```js
assert.match(code, /(?:const|let|var)\s+spreadsheetFunctions/);
```

Você deve usar `const` para declarar a variável `spreadsheetFunctions`.

```js
assert.match(code, /const\s+spreadsheetFunctions/);
```

A variável `spreadsheetFunctions` deve ser um objeto.

```js
assert.isObject(spreadsheetFunctions);
```

O objeto `spreadsheetFunctions` deve ter uma propriedade `sum`.

```js
assert.property(spreadsheetFunctions, "sum");
```

A propriedade `sum` deve ser a função `sum`.

```js
assert.equal(spreadsheetFunctions?.sum, sum);
```

O objeto `spreadsheetFunctions` deve ter uma propriedade `average`.

```js
assert.property(spreadsheetFunctions, "average");
```

A propriedade `average` deve ser a função `average`.

```js
assert.equal(spreadsheetFunctions?.average, average);
```

O objeto `spreadsheetFunctions` deve ter uma propriedade `median`.

```js
assert.property(spreadsheetFunctions, "median");
```

A propriedade `median` deve ser a função `median`.

```js
assert.equal(spreadsheetFunctions?.median, median);
```

Você deve usar a sintaxe de desestruturação para atribuir as propriedades.

```js
const objectText = code.replace(/.*const\s+spreadsheetFunctions\s*=\s*\{([^}]*)}.*/s, "$1");
assert.include(objectText, "sum");
assert.include(objectText, "average");
assert.include(objectText, "median");
assert.notInclude(objectText, ":");
```

# --seed--

## --seed-contents--

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="./styles.css" />
    <title>Functional Programming Spreadsheet</title>
  </head>
  <body>
    <div id="container">
      <div></div>
    </div>
    <script src="./script.js"></script>
  </body>
</html>
```

```css
#container {
  display: grid;
  grid-template-columns: 50px repeat(10, 200px);
  grid-template-rows: repeat(11, 30px);
}

.label {
  background-color: lightgray;
  text-align: center;
  vertical-align: middle;
  line-height: 30px;
}
```

```js
const isEven = num => num % 2 === 0;
const sum = nums => nums.reduce((acc, el) => acc + el, 0);
const average = nums => sum(nums) / nums.length;

const median = nums => {
  const sorted = nums.slice().sort((a, b) => a - b);
  const length = sorted.length;
  const middle = length / 2 - 1;
  return isEven(length)
    ? average([sorted[middle], sorted[middle + 1]])
    : sorted[Math.ceil(middle)];
}

--fcc-editable-region--

--fcc-editable-region--

const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index);
const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code));

window.onload = () => {
  const container = document.getElementById("container");
  const createLabel = (name) => {
    const label = document.createElement("div");
    label.className = "label";
    label.textContent = name;
    container.appendChild(label);
  }
  const letters = charRange("A", "J");
  letters.forEach(createLabel);
  range(1, 99).forEach(number => {
    createLabel(number);
    letters.forEach(letter => {
      const input = document.createElement("input");
      input.type = "text";
      input.id = letter + number;
      input.ariaLabel = letter + number;
      container.appendChild(input);
    })
  })
}
```
